package cl.uchile.sketchpad.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cl.uchile.sketchpad.persistance.dao.GroupDao;
import cl.uchile.sketchpad.persistance.model.Group;

@Service
public class GroupServiceImpl implements GroupService {
	@Autowired
	private GroupDao groupDao;

	@Override
	@Transactional(readOnly = true)
	public List<Group> getGroupsBySubjectVersionId(Integer subjectVersionId) {
		return groupDao.getAllBySubjectVersionId(subjectVersionId);
	}

	@Override
	public Group findById(Integer id) {
		return this.groupDao.findById(id);
	}
	
	@Override
	public void persist(Group g) {
		this.groupDao.persist(g);
	}
	
}